﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Main : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string maNguoiDung = (string)this.Session["LoaiNguoiDung"];

        if (maNguoiDung == null)
        {
            pnlMember.Visible = false;
            pnlGuest.Visible = true;
            pnl_Admin.Visible = false;
        }
        else
        {
            pnlMember.Visible = false;
            pnlGuest.Visible = false;
            pnl_Admin.Visible = false;
            switch (maNguoiDung)
            {

                //Admin
                case "1":
                    pnl_Admin.Visible = true;
                    break;
                //Mode
                case "2":
                    pnlMember.Visible = true;
                    break;
                //User Thường
                case "3":
                    pnlMember.Visible = true;

                    break;
                //User Vip
                case "4":
                    pnlMember.Visible = true;
                    break;
                default:
                    break;
            }
        }
        LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();


        var Logo =
            from vt in linQ.VI_TRI_QUANG_CAOs where vt.TenLoaiViTri == "Logo" && vt.Deleted == false select vt;

        if (Logo.Count() > 0)
        {
            Banner1.ViTriQuangCao = Logo.First();
        }
    }
    
    protected void hpVietNameseLanguage_Click(object sender, ImageClickEventArgs e)
    {

    }
    protected void hpEnlgishLanguage_Click(object sender, ImageClickEventArgs e)
    {

    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/TraCuu.aspx?Search=" + txtSearch.Text);
    }
}
